package com.hbnu.exercise.net;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class TcpServerDemo03
{
    public static void main(String[] args)
    {
        try
        {
            ServerSocket serverSocket = new ServerSocket(8888);

            Socket socket = serverSocket.accept();

            BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            BufferedWriter out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));

            String content = null;
            while ((content = in.readLine()) != null)
            {
                content = content.toUpperCase();

                out.write(content);
            }

            serverSocket.close();
        } catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}
